import request from "@/utils/request"

const url = '/kKonwledge'

// 获取分页数据
export function getKnowledgePageAPI({ page = 1, pageSize = 10, keyWord = '' }) {
    return request({
        url: `${url}`,
        params: {
            page,
            pageSize,
            keyWord
        }
    })
}

// 获取知识详情信息
export function getKnowledgeDetailAPI(id) {
    return request({
        url: `${url}/${id}`
    })
}

// 发布知识
export function pushKnowledgeAPI({ title, content, pic }) {
    return request({
        url: `${url}/publish`,
        method: 'POST',
        data: {
            title,
            content,
            pic
        }
    })
}

// 获取当前用户发布的文章
export function getOwnKnowledgeAPI() {
    return request({
        url: `${url}/users`,
    })
}

// 根据id删除文章
export function delKnowledgeAPI(id) {
    return request({
        url: `${url}/delete/${id}`
    })
}